home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / pcb121.zip / IF.INC < prev    next >
Text File  |  1992-01-23  |  7KB  |  176 lines

  1. ;;*****************************************************************************
  2. ;;                             if.inc           if.inc
  3. ;;*****************************************************************************
  4. ;;
  5. ;;  Copyright (C) 1989 Northwestern University, Vance Morrison
  6. ;;
  7. ;;
  8. ;; Permission to view, compile, and modify for LOCAL (intra-organization) 
  9. ;; USE ONLY is hereby granted, provided that this copyright and permission 
  10. ;; notice appear on all copies.  Any other use by permission only.
  11. ;;
  12. ;; Northwestern University makes no representations about the suitability 
  13. ;; of this software for any purpose.  It is provided "as is" without expressed 
  14. ;; or implied warranty.  See the copywrite notice file for complete details.
  15. ;;
  16. ;;****************************************************************************
  17. ;;
  18. ;; if.inc is a module that describes in INTERFACE (IF).  An interface 
  19. ;; basicly is a description of a network card that is reasonably card
  20. ;; independant
  21. ;;
  22. ;; if.inc is the dispatcher for the if object.  Basicly all this module does
  23. ;; is look up the name in its database, and based on its name, call the 
  24. ;; correct routine for that card type (WD .. )
  25. ;;
  26. ;;****************************************************************************
  27. ;;
  28. ;; The functions provided by this file are
  29. ;;
  30. ;;   IF_DECLARE name, real_if, type
  31. ;;      IF_DECLARE makes the association between the IF object 'name' and
  32. ;;      the object 'real_if' which acutally supplies the routines.  'type'
  33. ;;      is the prefix for the real if (eg.  WD)
  34. ;;   
  35. ;;   IF_R_ACCESS_out_BX_CX_ES interface, no_packet
  36. ;;       IF_R_ACCESS waits for the next packet to come from the the board
  37. ;;       associated with 'interface' and returns a pointer to the begining of 
  38. ;;       an ethernet packet in BX:ES.  If there is no packet to read in, 
  39. ;;       this function jumps to 'no_packet'
  40. ;;       
  41. ;;   IF_R_FREE_const_BX_CX_BP_SI_DI_ES interface
  42. ;;       After the client is through processing the packet returned by 
  43. ;;       IF_R_ACCESS, IF_R_FREE must be called to inform 'interface' that the 
  44. ;;       memory that the packet was in can be reused for future packets.
  45. ;;
  46. ;;   IF_R_CONT_in_BX_CX_ES_const_BX_CX_DX_BP_SI_DI_ES name, ok
  47. ;;       IF_R_CONT determines if the packet returned by R_READ in BX:ES
  48. ;;       of length CX is continuous.  If it is it jumps to 'ok' otherwise
  49. ;;       it just returns
  50. ;;
  51. ;;   IF_W_ACCESS_in_CX_out_DI_ES_const_BX_CX_BP interface, no_buffer
  52. ;;       IF_W_ACCESS returns a pointer to an output buffer for a packet.  The 
  53. ;;       pointer is returned in DI:ES.  If the ouptut buffer is busy, this 
  54. ;;       routine jump to 'no_buffer'.  the output buffer is guarenteed to
  55. ;;       be at least min (CX, 1514) (the MTU for Ethernet - 4 byte checksum) 
  56. ;;       bytes long.
  57. ;;
  58. ;;   IF_W_WRITE_in_CX_const_BX_BP_ES interface
  59. ;;       IF_W_WRITE actually signals the ethernet board to write a packet to 
  60. ;;       the ethernet.  The packet is assumed to be in the buffer returned by 
  61. ;;       IF_W_ACCESS. CX is the length of the packet to send.  
  62. ;;
  63. ;;   IF_SET_ADDRESS_in_SI_const_BX_CX_BP_DI_ES interface
  64. ;;       IF_SET_ADDRESS_in_SI sets the hardware address to be the value
  65. ;;       pointed to by SI.  Note this function may be a no-op if the
  66. ;;       hardware address cannot be set (ETHERNET for example)
  67. ;;
  68. ;;   IF_COPY_in_CX_SI_DI_ES_out_SI_DI_const_BX_BP_ES interface
  69. ;;      IF_COPY_in_CX_SI_DI_ES copys a packet from the input buffer (pointed 
  70. ;;      to by SI and the segement register given in IF_DECLARE) to an output 
  71. ;;      buffer (pointed to by DI and dest_reg) of length CX.   It assumes the
  72. ;;      output buffer is contiguous.  (and the caller shouldn't care if the 
  73. ;;      input buffer is contiguous)  COPY updates the pointers SI and DI
  74. ;;      to the end of the packet, and COPY could be called again if CX is not
  75. ;;      the total packet length (Note that CX MUST be even if you care about
  76. ;;      SI, and DI being updated properly)
  77. ;;
  78. ;;  The variable provided by this module are (READ ONLY!!!)
  79. ;;
  80. ;;      if_&name&_address               ;; the hardware address
  81. ;;      if_&name&_mtu                   ;; the maximum transmition unit
  82. ;;
  83. ;;****************************************************************************
  84.  
  85. ;;****************************************************************************
  86. ;; IF_DECLARE name, real_if, type
  87. ;;   
  88. IF_DECLARE MACRO name, real_if, type
  89.  
  90.     if_&name&_name = real_if
  91.     if_&name&_type equ <type>
  92.  
  93.     if name ne real_if
  94.         if_&name&_address = if_&real_if&_address
  95.         if_&name&_mtu = if_&real_if&_mtu
  96.     endif
  97. ENDM
  98.  
  99. ;;******************************************************************************
  100. ;;   IF_R_ACCESS_out_BX_CX_ES name, no_packet
  101. ;;       
  102. IF_R_ACCESS_out_BX_CX_ES MACRO name, no_packet
  103.     HELPER macro myname, type, myno_packet
  104.         type&&_IF_R_ACCESS_out_BX_CX_ES myname, myno_packet
  105.     ENDM
  106.  
  107.     HELPER  %if_&name&_name, %if_&name&_type, no_packet
  108. ENDM
  109.  
  110. ;;******************************************************************************
  111. ;;   IF_R_FREE name
  112. ;;
  113. IF_R_FREE_const_BX_CX_BP_SI_DI_ES MACRO name
  114.     HELPER macro myname, type
  115.         type&&_IF_R_FREE_const_BX_CX_BP_SI_DI_ES myname
  116.     ENDM
  117.  
  118.     HELPER  %if_&name&_name, %if_&name&_type
  119. ENDM
  120.  
  121. ;;******************************************************************************
  122. ;; IF_R_CONT_in_BX_CX_ES name, ok
  123. ;;
  124. IF_R_CONT_in_BX_CX_ES_const_BX_CX_DX_BP_SI_DI_ES MACRO name, ok
  125.     HELPER macro myname, type, myok
  126.         type&&_IF_R_CONT_in_BX_CX_ES_const_BX_CX_DX_BP_SI_DI_ES myname, myok
  127.     ENDM
  128.  
  129.     HELPER  %if_&name&_name, %if_&name&_type, ok
  130. ENDM
  131.  
  132. ;;******************************************************************************
  133. ;;   IF_W_ACCESS_in_CX_out_DI_ES name, no_buffer
  134. ;;
  135. IF_W_ACCESS_in_CX_out_DI_ES_const_BX_CX_BP MACRO name, no_buffer
  136.     HELPER macro myname, type, myno_buffer
  137.         type&&_IF_W_ACCESS_in_CX_out_DI_ES_const_BX_CX_BP myname, myno_buffer
  138.     ENDM
  139.  
  140.     HELPER  %if_&name&_name, %if_&name&_type, no_buffer
  141. ENDM
  142.  
  143. ;;******************************************************************************
  144. ;;   IF_W_WRITE_in_CX interface
  145. ;;
  146. IF_W_WRITE_in_CX_const_BX_BP_ES MACRO name
  147.     HELPER macro myname, type
  148.         type&&_IF_W_WRITE_in_CX_const_BX_BP_ES myname
  149.     ENDM
  150.  
  151.     HELPER  %if_&name&_name, %if_&name&_type
  152. ENDM
  153.  
  154. ;;******************************************************************************
  155. ;;   IF_SET_ADDRESS_in_SI interface
  156. ;;
  157. IF_SET_ADDRESS_in_SI_const_BX_CX_BP_DI_ES MACRO name
  158.     HELPER macro myname, type
  159.         type&&_IF_SET_ADDRESS_in_SI_const_BX_CX_BP_DI myname
  160.     ENDM
  161.  
  162.     HELPER  %if_&name&_name, %if_&name&_type
  163. ENDM
  164.  
  165. ;;******************************************************************************
  166. ;;   IF_COPY_in_CX_SI_DI_ES_out_SI_DI interface
  167. ;;
  168. IF_COPY_in_CX_SI_DI_ES_out_SI_DI_const_BX_BP_ES MACRO name
  169.     HELPER macro myname, type
  170.         type&&_IF_COPY_in_CX_SI_DI_ES_out_SI_DI_const_BX_BP_ES myname
  171.     ENDM
  172.  
  173.     HELPER  %if_&name&_name, %if_&name&_type
  174. ENDM
  175.  
  176.